package controller.menubar.commands;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import view.MainFrame;

	
public class Copy implements ActionListener {
	
	public Copy(MainFrame frame) {			
		this.frame = frame;			
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		final File from =  frame.getMainPanel().getPrimary().getDiskContent().getSelectedFile();						
		final File to = frame.getMainPanel().getSecondary().getDiskContent().getActualFile();		
		
		final String newFile = to.getAbsolutePath() + File.separator + from.getName() ;
		
		Runnable task = new Runnable() {

			@Override
			public void run() {
				new FileCopierUtility(frame,from,new File(newFile),true).setVisible(true);			
			}			
		};		
		task.run();
	}
	
	private MainFrame frame;
	
	
		
}	
		
		
		
		
		


	